﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Split
{
	class Program
	{
		static void Main(string[] args)
		{
			string str = "Kostya,Irina,Yan,Roman,Alex,Elena,Timur";
			int indexEnd = str.Length;
			int indexStart = str.Length;
			do
			{
				indexStart = str.LastIndexOf(",", indexEnd - 1);

				string S = str.Substring(indexStart + 1, indexEnd - (indexStart + 1));

				Console.WriteLine(S);

				indexEnd = indexStart;
			} while (indexStart > -1);
			//} while (str.IndexOf(",", indexB) != -1);

			Console.ReadLine();
		}
		
	}
}
